<?php

namespace App\Rep;

use App\Models\Maintain;

class MaintainRep
{
    //获取维修库列表
    public function getMaintainListRep($params){
        $list = Maintain::Search($params)
            ->with(['semi'=>function($q){
                $q->with(['models'=>function($q){
                    $q->select('modelid','modelname');
                },'product'=>function($q){
                    $q->select('id','product_name');
                },'specification'=>function($q){
                    $q->select('id','specification');
                },'model_number'=>function($q){
                    $q->select('id','model_number');
                },'color'=>function($q){
                    $q->select('id','color');
                }]);
            }])
            ->orderBy('id','desc')->paginate($params['per_page']??20);
        return $list;
    }

}
